﻿using System.Configuration;
using Atom.Common.CustomConfiguration;

namespace Atom.Common.Configuration
{
    public class ResourceSettings: ConfigurationSection
    {
        [ConfigurationProperty("defaultProvider", IsRequired = true)]
        public string DefaultProvider
        {
            get
            {
                return (string)this["defaultProvider"];
            }
            set
            {
                this["defaultProvider"] = value;
            }
        }

        [ConfigurationProperty("providers", IsRequired = true)]
        public NameTypeElementCollection<ResourceProviderConfigurationElement> Providers
        {
            get
            {
                return (NameTypeElementCollection<ResourceProviderConfigurationElement>)this["providers"];
            }
            set
            {
                this["providers"] = value;
            }
        }

        public static ResourceSettings GetConfiguration()
        {
            return (ResourceSettings)ConfigurationManager.GetSection("Atom.resources");
        }
    }
}